package org.jivesoftware.smackx.workgroup.packet;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.xmlpull.v1.XmlPullParser;

public class AgentStatusRequest extends IQ
{
  public static final String ELEMENT_NAME = "agent-status-request";
  public static final String NAMESPACE = "http://jabber.org/protocol/workgroup";
  private Set<Item> agents = new HashSet();

  public int getAgentCount()
  {
    return this.agents.size();
  }

  public Set<Item> getAgents()
  {
    return Collections.unmodifiableSet(this.agents);
  }

  // ERROR //
  public String getChildElementXML()
  {
    // Byte code:
    //   0: new 50	java/lang/StringBuilder
    //   3: dup
    //   4: invokespecial 51	java/lang/StringBuilder:<init>	()V
    //   7: astore_1
    //   8: aload_1
    //   9: ldc 53
    //   11: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   14: ldc 14
    //   16: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   19: ldc 59
    //   21: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   24: ldc 17
    //   26: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   29: ldc 61
    //   31: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   34: pop
    //   35: aload_0
    //   36: getfield 29	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest:agents	Ljava/util/Set;
    //   39: astore_3
    //   40: aload_3
    //   41: monitorenter
    //   42: aload_0
    //   43: getfield 29	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest:agents	Ljava/util/Set;
    //   46: invokeinterface 65 1 0
    //   51: astore 5
    //   53: aload 5
    //   55: invokeinterface 71 1 0
    //   60: ifne +29 -> 89
    //   63: aload_3
    //   64: monitorexit
    //   65: aload_1
    //   66: ldc 73
    //   68: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   71: aload_0
    //   72: invokevirtual 76	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest:getElementName	()Ljava/lang/String;
    //   75: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   78: ldc 78
    //   80: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   83: pop
    //   84: aload_1
    //   85: invokevirtual 81	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   88: areturn
    //   89: aload 5
    //   91: invokeinterface 85 1 0
    //   96: checkcast 6	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest$Item
    //   99: astore 6
    //   101: aload_1
    //   102: ldc 87
    //   104: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   107: aload 6
    //   109: invokevirtual 90	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest$Item:getJID	()Ljava/lang/String;
    //   112: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   115: ldc 61
    //   117: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   120: pop
    //   121: aload 6
    //   123: invokevirtual 93	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest$Item:getName	()Ljava/lang/String;
    //   126: ifnull +27 -> 153
    //   129: aload_1
    //   130: ldc 95
    //   132: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   135: pop
    //   136: aload_1
    //   137: aload 6
    //   139: invokevirtual 93	org/jivesoftware/smackx/workgroup/packet/AgentStatusRequest$Item:getName	()Ljava/lang/String;
    //   142: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   145: pop
    //   146: aload_1
    //   147: ldc 97
    //   149: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   152: pop
    //   153: aload_1
    //   154: ldc 99
    //   156: invokevirtual 57	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   159: pop
    //   160: goto -107 -> 53
    //   163: astore 4
    //   165: aload_3
    //   166: monitorexit
    //   167: aload 4
    //   169: athrow
    //
    // Exception table:
    //   from	to	target	type
    //   42	65	163	finally
    //   89	167	163	finally
  }

  public String getElementName()
  {
    return "agent-status-request";
  }

  public String getNamespace()
  {
    return "http://jabber.org/protocol/workgroup";
  }

  public static class Item
  {
    private String jid;
    private String name;
    private String type;

    public Item(String paramString1, String paramString2, String paramString3)
    {
      this.jid = paramString1;
      this.type = paramString2;
      this.name = paramString3;
    }

    public String getJID()
    {
      return this.jid;
    }

    public String getName()
    {
      return this.name;
    }

    public String getType()
    {
      return this.type;
    }
  }

  public static class Provider
  implements IQProvider
  {
    private AgentStatusRequest.Item parseAgent(XmlPullParser paramXmlPullParser)
      throws Exception
    {
      int i = 0;
      String str1 = paramXmlPullParser.getAttributeValue("", "jid");
      String str2 = paramXmlPullParser.getAttributeValue("", "type");
      String str3 = null;
      while (true)
      {
        int j;
        do
          while (true)
          {
            if (i != 0)
              return new AgentStatusRequest.Item(str1, str2, str3);
            j = paramXmlPullParser.next();
            if ((j != 2) || (!("name".equals(paramXmlPullParser.getName()))))
              break;
            str3 = paramXmlPullParser.nextText();
          }
        while ((j != 3) || (!("agent".equals(paramXmlPullParser.getName()))));
        i = 1;
      }
    }

    public IQ parseIQ(XmlPullParser paramXmlPullParser)
      throws Exception
    {
      AgentStatusRequest localAgentStatusRequest = new AgentStatusRequest();
      if (paramXmlPullParser.getEventType() != 2)
        throw new IllegalStateException("Parser not in proper position, or bad XML.");
      int i = 0;
      while (true)
      {
        int j;
        do
          while (true)
          {
            if (i != 0)
              return localAgentStatusRequest;
            j = paramXmlPullParser.next();
            if ((j != 2) || (!("agent".equals(paramXmlPullParser.getName()))))
              break;
            AgentStatusRequest.access$0(localAgentStatusRequest).add(parseAgent(paramXmlPullParser));
          }
        while ((j != 3) || (!("agent-status-request".equals(paramXmlPullParser.getName()))));
        i = 1;
      }
    }
  }
}